# For the benefit of emacs users: -*- shell-script -*-
#
#  _ _____                    __ _
# (_)___ /    ___ ___  _ __  / _(_) __ _
# | | |_ \   / __/ _ \| '_ \| |_| |/ _` |
# | |___) | | (_| (_) | | | |  _| | (_| |
# |_|____/   \___\___/|_| |_|_| |_|\__, |
#                                  |___/

# Default modkey
set $mod Mod4

# Hide titlebar
new_window pixel

# Font for window titles.
font pango: SauceCodePro Nerd Font 10

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# Start a terminal
bindsym $mod+Return exec alacritty

# Kill focused window
bindsym $mod+Shift+q kill

# Start rofi
bindsym $mod+d exec rofi -show drun -columns 3

# Move between windows
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

# Alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# Move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right

# Alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# Split in horizontal orientation
bindsym $mod+h split h

# Split in vertical orientation
bindsym $mod+v split v

# Enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# Change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# Toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# Change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# Focus the parent container
bindsym $mod+a focus parent

# Name the workspaces
set $workspace1 "1:  "
set $workspace2 "2:  "
set $workspace3 "3:  "
set $workspace4 "4:  "
set $workspace5 "5:  "
set $workspace6 "6:  "
set $workspace7 "7:  "
set $workspace8 "8: ♫ "
set $workspace9 "9:  "
set $workspace0 "10:  "

# Switch to workspace
bindsym $mod+1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4
bindsym $mod+5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+9 workspace $workspace9
bindsym $mod+0 workspace $workspace0

# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4
bindsym $mod+Shift+5 move container to workspace $workspace5
bindsym $mod+Shift+6 move container to workspace $workspace6
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $workspace8
bindsym $mod+Shift+9 move container to workspace $workspace9
bindsym $mod+Shift+0 move container to workspace $workspace0

# Always open some programs on specified workspace
assign [class="^Firefox"]          $workspace1
assign [class="^Emacs"]            $workspace2
assign [class="^Gimp"]             $workspace4
assign [class="^Nautilus"]         $workspace4
assign [class="^Slack"]            $workspace7
assign [class="^Telegram-desktop"] $workspace7
assign [class="^Cmus"]             $workspace8
assign [class="^Spotify"]          $workspace8
assign [class="^Thunderbird"]      $workspace9

# Enable float for some windows
for_window [class="^Pavucontrol$"]  floating enable
for_window [class="^Lxappearance$"] floating enable
for_window [class="^Arandr$"]       floating enable

# Always open workspaces in certain outputs
workspace "1:  " output primary
workspace "2:  " output primary
workspace "3:  " output primary
workspace "4:  " output primary
workspace "5:  " output primary
workspace "7:  " output DP-4
workspace "8: ♫ " output DP-4
workspace "9:  " output DP-4
workspace "10:  " output DP-4

# Reload the configuration file
bindsym $mod+Shift+c reload

# Restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart

# Lock screen
bindsym $mod+Shift+x exec betterlockscreen -l dimblur

# Resize window (you can also use the mouse for that)
mode "resize"
{
    # Resize with the arrow keys
    bindsym Left  resize shrink width  1 px or 1 ppt
    bindsym Down  resize grow   height 1 px or 1 ppt
    bindsym Up    resize shrink height 1 px or 1 ppt
    bindsym Right resize grow   width  1 px or 1 ppt

    # Back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"
bindsym $mod+Shift+e exec "~/.config/i3blocks/blocks/shutdown_menu/shutdown_menu"

# class                 border  bground text    indicator child_border
client.focused          #6272A4 #6272A4 #F8F8F2 #6272A4   #6272A4
client.focused_inactive #44475A #44475A #F8F8F2 #44475A   #44475A
client.unfocused        #282A36 #282A36 #BFBFBF #282A36   #282A36
client.urgent           #44475A #FF5555 #F8F8F2 #FF5555   #FF5555
client.placeholder      #282A36 #282A36 #F8F8F2 #282A36   #282A36
client.background       #F8F8F2

# Start i3blocks to display a workspace bar
bar {
    font pango: SauceCodePro Nerd Font 9
    i3bar_command i3bar
    output primary
    position top
    status_command i3blocks
    strip_workspace_numbers yes
    tray_output nonprimary

    colors {
        background #282A36
        statusline #F8F8F2
        separator  #44475A

        focused_workspace  #44475A #44475A #F8F8F2
        active_workspace   #282A36 #44475A #F8F8F2
        inactive_workspace #282A36 #282A36 #BFBFBF
        urgent_workspace   #FF5555 #FF5555 #F8F8F2
        binding_mode       #FF5555 #FF5555 #F8F8F2
    }
}

bar {
    font pango: SauceCodePro Nerd Font 10
    i3bar_command i3bar
    output nonprimary
    position top
    strip_workspace_numbers yes
    tray_output DP-4

    colors {
        background #282A36
        statusline #F8F8F2
        separator  #44475A

        focused_workspace  #44475A #44475A #F8F8F2
        active_workspace   #282A36 #44475A #F8F8F2
        inactive_workspace #282A36 #282A36 #BFBFBF
        urgent_workspace   #FF5555 #FF5555 #F8F8F2
        binding_mode       #FF5555 #FF5555 #F8F8F2
    }
}

# Startup programs
exec_always --no-startup-id ~/.scripts/monitors.sh
exec_always --no-startup-id ~/.scripts/wallpapers.sh
exec --no-startup-id betterlockscreen -w dim
exec --no-startup-id picom --config ~/.config/picom/picom.conf
exec --no-startup-id xfce4-power-manager
exec --no-startup-id notify-send "Welcome back $USER!" -i ~/.images/icons8-dog-100.png
